package com.gitee.sunshine.factory;

import org.springframework.stereotype.Component;

@Component
public class ServiceInvocationContextFactory {
	
	private ThreadLocal<ServiceInvocationContext> threadLocal = new ThreadLocal<ServiceInvocationContext>();
	
	public ServiceInvocationContext getContext() {
		ServiceInvocationContext context = threadLocal.get();
		if (context == null) {
			context = init();
			threadLocal.set(context);
		}

		return context;
	}

	private ServiceInvocationContext init() {
		StackContext context = new StackContext();
		return context;
	}
}
